﻿<%@ include file="../base/include.jsp"%>

<%--
Current Locale: ${pageContext.response.locale}
<p>	Request Locale:	<%=request.getLocale()%></p>
 --%>

<div class="row">
	<div class="span4 offset4 well">
		<form name='loginForm'
			action="<c:url value='j_spring_security_check'/>" method='POST'>
			<legend>
				Login Here = Логин =
				<spring:message code="login.login" />
			</legend>
			<div class="page-header">
				<h3>Sign in</h3>
			</div>

			<div class="row control-group">
				<div class="span1">
					<label for="username">Nickname:</label>
				</div>
				<div class="span3">
					<input id="username" name="j_username" type="text" class="span3" />
				</div>
			</div>
			<div class="row control-group">
				<div class="span1">
					<label for="password">Password:</label>
				</div>
				<div class="span3">
					<input id="password" name="j_password" type="password"
						class="span3" />
				</div>
			</div>

			<div class="row control-group">
				<div class="span2 offset1">
					<label class="checkbox"> <input id="remember_me"
						type="checkbox" name="_spring_security_remember_me" /> Stay
						signed in
					</label>
				</div>
				<div class="span1">
					<button type="submit" class="btn btn-primary pull-right"
						style="width: 80px;">Sign in</button>
				</div>
			</div>

			<div class="row control-group">
				<div class="span2">
					<a href="<c:url value="/register" />">Create account</a>
				</div>
				<div class="span2">
					<a class="pull-right" href="<c:url value="/restorePassword" />">I
						forgot my password</a>
				</div>
			</div>
		</form>

		<c:if test="${not empty param.failure}">
			<div class="row control-group">
				<div class="span4">
					<textarea style="width: inherit; height: auto;"
						class="label label-important">${sessionScope["SPRING_SECURITY_LAST_EXCEPTION"].message}
					</textarea>
				</div>
			</div>
		</c:if>
	</div>
</div>

<script>
	if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) {
		var _interval = window.setInterval(function() {
			var autofills = $('input:-webkit-autofill');
			if (autofills.length > 0) {
				window.clearInterval(_interval); // stop polling
				autofills.each(function() {
					var clone = $(this).clone(true, true);
					$(this).after(clone).remove();
				});
			}
		}, 200);
	}
</script>